# # 定义不同类型的变量
# int_one = 10
# float_one = 10.534
# string_one = "Hello python"
#
#
# # 打印变量及其类型
# print(f"Int: {int_one}, Type: {type(int_one)}")
# print(f"Float: {float_one}, Type: {type(float_one)}")
# print(f"String: {string_one}, Type: {type(string_one)}")
# #
# a = 10
# print(a)
# print(bin(a))  # 转为二进制
# print(oct(a))   # 转为八进制
# print(hex(a))  # 转为十六进制

# ow_sum = sum(i for i in range(1, 101) if i % 2 != 0)
# print(f"1到100之间所有奇数的和: {ow_sum}")


# def count_ones_in_binary(num):
#     if num < 0:
#         # 对于负数，按64位处理
#         num = num & ((1 << 64) - 1)
#     count = 0
#     while num:
#         count += num & 1  # 判断最低位是否为1
#         num >>= 1  # 右移一位
#     return count
#
# num = int(input("Enter an integer: "))
# print(f"Number of 1s in the binary representation: {count_ones_in_binary(num)}")
# def homework4():
#     print(sum([x for x in range(1,101)if x%2==1]))
# homework4()
# 九九乘法表
def homework():
    for i in range(1,10):
       print(i)
homework()

for i in range(1,10):
    for j in range(1,i+1):
        print(f"{j} * {i} = {j*i}",end="\t")
    print()
# 统计一个整数对应的二进制数的1的个数，输入一个整数，输出该整数的二进制包含1的个数
def homework6():
    num=int(input('请输入一个整数'))
    if num>=0:
        print(bin(num).count('1'))
    else:
        print(64-bin(num).count('0'))
homework6()

def homework6_2():

    num=int(input('请输入一个整数'))
    count=0
    check_flag=1
    for i in range(64):
        if num & check_flag:
            count+=1
            check_flag<<=1
homework6_2()